package ${package.Controller};

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import ${package.ServiceImpl}.${table.serviceImplName};
import ${package.Entity}.${entity};
import ${package.Other}.${entity}DTO;
import ${package.Other}.${entity}VO;
import com.lcf.common.web.Result;
import com.lcf.common.web.PageDTO;
import com.lcf.app.generator.common.BaseController;
<#if swagger>
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
</#if>
<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
</#if>

<#if superControllerClassPackage??>
import ${superControllerClassPackage};
</#if>


/**
 * <p>
 * ${table.comment!} 前端控制器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
<#if swagger>
@Api(tags = "${table.comment!}")
</#if>
<#if restControllerStyle>
@RestController
<#else>
@Controller
</#if>
@RequestMapping("<#if package.ModuleName?? && package.ModuleName != "">/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} extends BaseController<${table.serviceImplName}> {

    <#if swagger>
    @ApiOperation("查询单个")
    </#if>
    @GetMapping("/{id}")
    public Result<${entity}VO> get(@PathVariable("id") String id) {
        return service.getInfo(id);
    }

    <#if swagger>
    @ApiOperation("添加")
    </#if>
    @PostMapping("")
    public Result<${entity}> save(@RequestBody ${entity}DTO dto) {
        return service.saveInfo(dto);
    }

    <#if swagger>
    @ApiOperation("编辑")
    </#if>
    @PutMapping("")
    public Result<${entity}> update(@RequestBody ${entity}DTO dto) {
        return service.updateInfo(dto);
    }

    <#if swagger>
    @ApiOperation("删除")
    </#if>
    @DeleteMapping("/{id}")
    public Result<String> remove(@PathVariable("id") String id) {
        return service.removeInfo(id);
    }

    <#if swagger>
    @ApiOperation("分页查询")
    </#if>
    @PostMapping("paging")
    public Result<Page<${entity}VO>> paging(@RequestBody PageDTO dto){
        return service.paging(dto);
    }
</#if>

}
</#if>
